﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using BLL;

public partial class ProductPackage_PrinterPackagePrkductSN32 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        if (Check() == true)
        {
            this.Label1.Text = "*" + this.TextBox1.Text.Trim() + "*";
            this.Label2.Text = "*" + this.TextBox2.Text.Trim() + "*";
            this.Label3.Text = "*" + this.TextBox3.Text.Trim() + "*";
            this.Label4.Text = "*" + this.TextBox4.Text.Trim() + "*";
            this.Label5.Text = "*" + this.TextBox5.Text.Trim() + "*";
            this.Label6.Text = "*" + this.TextBox6.Text.Trim() + "*";
            this.Label7.Text = "*" + this.TextBox7.Text.Trim() + "*";
            this.Label8.Text = "*" + this.TextBox8.Text.Trim() + "*";
            this.Label9.Text = "*" + this.TextBox9.Text.Trim() + "*";
            this.Label10.Text = "*" + this.TextBox10.Text.Trim() + "*";
            this.Label11.Text = "*" + this.TextBox11.Text.Trim() + "*";
            this.Label12.Text = "*" + this.TextBox12.Text.Trim() + "*";
            this.Label13.Text = "*" + this.TextBox13.Text.Trim() + "*";
            this.Label14.Text = "*" + this.TextBox14.Text.Trim() + "*";
            this.Label15.Text = "*" + this.TextBox15.Text.Trim() + "*";
            this.Label16.Text = "*" + this.TextBox16.Text.Trim() + "*";
            this.Label17.Text = "*" + this.TextBox17.Text.Trim() + "*";
            this.Label18.Text = "*" + this.TextBox18.Text.Trim() + "*";
            this.Label19.Text = "*" + this.TextBox19.Text.Trim() + "*";
            this.Label20.Text = "*" + this.TextBox20.Text.Trim() + "*";
            this.Label21.Text = "*" + this.TextBox21.Text.Trim() + "*";
            this.Label22.Text = "*" + this.TextBox22.Text.Trim() + "*";
            this.Label23.Text = "*" + this.TextBox23.Text.Trim() + "*";
            this.Label24.Text = "*" + this.TextBox24.Text.Trim() + "*";
            this.Label25.Text = "*" + this.TextBox25.Text.Trim() + "*";
            this.Label26.Text = "*" + this.TextBox26.Text.Trim() + "*";
            this.Label27.Text = "*" + this.TextBox27.Text.Trim() + "*";
            this.Label28.Text = "*" + this.TextBox28.Text.Trim() + "*";
            this.Label29.Text = "*" + this.TextBox29.Text.Trim() + "*";
            this.Label30.Text = "*" + this.TextBox30.Text.Trim() + "*";
            this.Label31.Text = "*" + this.TextBox31.Text.Trim() + "*";
            this.Label32.Text = "*" + this.TextBox32.Text.Trim() + "*";
        }
    }

    protected Boolean Check()
    {
        PackageProduct pp = new PackageProduct();
        string var_SN3BK = this.TextBox33.Text.Trim();
        string[] SNs ={this.TextBox1.Text.Trim(),this.TextBox2.Text.Trim(),this.TextBox3.Text.Trim(),
                         this.TextBox4.Text.Trim(),this.TextBox5.Text.Trim(),this.TextBox6.Text.Trim(),
                         this.TextBox7.Text.Trim(),this.TextBox8.Text.Trim(),this.TextBox9.Text.Trim(),
                         this.TextBox10.Text.Trim(),this.TextBox11.Text.Trim(),this.TextBox12.Text.Trim(),
                         this.TextBox13.Text.Trim(),this.TextBox14.Text.Trim(),this.TextBox15.Text.Trim(),
                         this.TextBox16.Text.Trim(),this.TextBox17.Text.Trim(),this.TextBox18.Text.Trim(),
                         this.TextBox19.Text.Trim(),this.TextBox20.Text.Trim(),this.TextBox21.Text.Trim(),
                         this.TextBox22.Text.Trim(),this.TextBox23.Text.Trim(),this.TextBox24.Text.Trim()
                         ,this.TextBox25.Text.Trim(),
                         this.TextBox26.Text.Trim(),this.TextBox27.Text.Trim(),this.TextBox28.Text.Trim(),
                         this.TextBox29.Text.Trim(),this.TextBox30.Text.Trim(),this.TextBox31.Text.Trim(),
                         this.TextBox32.Text.Trim()
                      };
        for (int i = 1; i < 33; i++)
        {
            if (i > 1)
            {
                for (int j = 0; j < i - 1; j++)
                {
                    if (SNs[j] == SNs[i - 1])
                    {
                        string str = "第 " + i + " 个与第" + j + 1 + "个成品序列号重复！";
                        ClientScript.RegisterStartupScript(ClientScript.GetType(), "", "<script>alert('" + str + "');</script>");
                        return false;
                    }
                }
            }
            if (pp.IsvalidMatchingSN_SN3BK(SNs[i - 1]) != var_SN3BK)
            {
                string str = "第 " + i + " 个成品序列号与3BK对应不正确！";
                ClientScript.RegisterStartupScript(ClientScript.GetType(), "", "<script>alert('" + str + "');</script>");
                return false;
            }
        }
        return true;
    }
}
